package Page;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;


public class Main {
	
	private static String driver = "com.mysql.cj.jdbc.Driver";  //获取mysql 8.0数据库的驱动类
	private static String url = "jdbc:mysql://localhost:3306/addressbook?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true"; //连接数据库（meizu是数据库名）

	private static String name = "root";//连接mysql的用户名
	private static String pwd = "hjnsds111111";//连接mysql的密码
	
	public static  void main(String[] args) throws SQLException {

		Connection con = DriverManager.getConnection(url,name,pwd);// 连接数据库对象
		Statement statement = con.createStatement();// 创建SQL命令对象
	
		
		Index i=new Index();
		i.index(statement);
	}
	
	public static Connection getConnection(){
	    try{
	      Connection conn = DriverManager.getConnection(url,name,pwd);//获取连接对象
	      return conn;
	    }catch(SQLException e){
	      e.printStackTrace();
	      return null;
	    }
	  }
 

}
